package thread;

class MyRunnable implements Runnable {
    @Override
    public void run() {
        try {
            while (true) {
                Thread.sleep(1000);
                System.out.println("threat1 ");
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

public class Demo02 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread1 = new MyThread();
        thread1.start();
        while (true) {
            System.out.println("main thread...");
            Thread.sleep(1000);
        }
    }
}
